namespace SqlQueryBuilder.Clauses
{
    /// <summary>
    /// Not Clause
    /// </summary>
    public class Not : IConditionalClause
    {
        private readonly IConditionalClause conditionalClause;

        /// <summary>
        /// Initializes a new instance of the <see cref="Not"/> class.
        /// </summary>
        /// <param name="conditionalClause">The where clause.</param>
        public Not(IConditionalClause conditionalClause)
        {
            this.conditionalClause = conditionalClause;
        }

        /// <summary>
        /// Builds the where clause.
        /// </summary>
        /// <returns></returns>
        public string BuildConditionalClause()
        {
            return CreateClause();
        }

        /// <summary>
        /// Creates the clause.
        /// </summary>
        /// <returns></returns>
        private string CreateClause()
        {
            return string.Format("NOT {0}",conditionalClause.BuildConditionalClause());
        }
    }
}